//
//  UIBarButtonItem+BarButtonItem.m
//  FangXinLang
//
//  Created by AJY on 16/9/18.
//  Copyright © 2016年 AJY. All rights reserved.
//

#import "UIBarButtonItem+BarButtonItem.h"

@implementation UIBarButtonItem (BarButtonItem)

+(UIBarButtonItem *)barButtonItemWith:(UIButton *)btn andTarget:(id)self1 andAction:(SEL)select andImage:(NSString *)imageName andImageHeight:(NSString *)imageHeightName{
    //设置普通图片
    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    //设置高量图片
    [btn setImage:[UIImage imageNamed:imageHeightName] forState:UIControlStateHighlighted];
    //设置单击事件
    [btn addTarget:self1 action:select forControlEvents:UIControlEventTouchUpInside];
    //设置自适应
    [btn sizeToFit];
    //自定义Item
    UIBarButtonItem * item = [[UIBarButtonItem alloc]initWithCustomView:btn];
    return item;
}

@end
